import 'dart:math';

import 'package:flutter/material.dart';

class TooltipHomePage extends StatefulWidget {
  @override
  _TooltipHomePageState createState() => _TooltipHomePageState();
}

class _TooltipHomePageState extends State<TooltipHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('tooltip')),
      body: Container(
        width: 500,
        alignment: Alignment.center,
        child: Tooltip(
          // margin: EdgeInsets.all(50),
          message: "小提示",
          // 显示在下方
          preferBelow: true,
          // 显示时间
          showDuration: Duration(seconds: 3),
          // 内边距
          padding: EdgeInsets.all(10),
          // // 外边距
          margin: EdgeInsets.only(top: 20, left: 20),
          // 垂直偏移量
          // verticalOffset: 100,
          // decoration: BoxDecoration(
          //   border: Border.all(color: Colors.red),
          //   color: Colors.green,
          // ),
          child: ElevatedButton(
            onPressed: () {},
            child: Text('这是提示'),
          ),
        ),
      ),
    );
  }
}
